import java.util.Scanner;

public class question3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        String str = in.nextLine();
        char[] array = str.toCharArray();

        //用 StringBuilder 来模拟栈
        StringBuilder stack = new StringBuilder();
        for(int i = 0; i < array.length; i++) {
            char ch = array[i];
            //如果重复就出栈
            if(stack.length() != 0 && ch == stack.charAt(stack.length()-1)) {
                stack.deleteCharAt(stack.length()-1);
            }else {
                //进栈
                stack.append(ch);
            }
        }
        System.out.println(stack.length() == 0 ? 0 : stack.toString());
    }
}
